package com.jyh.homework;

import java.io.*;
import java.nio.charset.Charset;

/**
 * @Author JYH
 * @Date 2024/8/5 17:16
 * @Description 把今天的作业中《我想对你说.txt》字符编码为GBK，复制到当前项目的testIO文件夹下的《章老师的话.txt》字符编码为UTF-8
 */
public class HomeWork2 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("D:\\course\\02-JavaSE-plus\\day9-IO流\\作业\\我想对你说.txt", Charset.forName("GB2312")));
        BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\course\\02-JavaSE-plus\\day9-IO流\\testIO\\章老师的话.txt"));

        char[] car = new char[1024];
        int len=-1;
        while ((len=br.read(car))!=-1){
            bw.write(car,0,len);
            bw.flush();
        }
        bw.close();
        br.close();

    }
}
